package com.itheima.advantagesup.mapper;

import com.itheima.advantagesup.entity.YddCate;
import com.itheima.advantagesup.vo.CateVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface YddCateMapper {
    /**
     * 得到全部数据
     * @return {@link List}<{@link CateVO}>
     */
    List<CateVO> all() ;

    /**
     * 模糊查询
     * @param catename
     * @return {@link List}<{@link YddCate}>
     */
    @Select("select * from ydd_cate where catename like concat('%',#{catename},'%')")
    List<YddCate> list(String catename);

    /**
     * 添加分类
     * @param yddCate
     */
    void add(YddCate yddCate);

    /**
     * 根据id删除分类
     * @param id
     */
    @Delete("delete from ydd_cate where id = #{id}")
    void delete(String id);

    /**
     * 根据id查询分类
     * @param id
     * @return {@link YddCate}
     */
    @Select("select * from ydd_cate where id = #{id}")
    YddCate getCateById(String id);

    /**
     * 修改员工
     * @param yddCate
     */
    void update(YddCate yddCate);
}
